<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
	<title>试题管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
	<script type="text/javascript" src="__JS__/jshelper.js"></script>
	
			<script type="text/JavaScript">
				function testedit(id){
					window.location.href="__URL__/detail/id/"+id;
				}
				function testpackage(id){
					window.location.href="__URL__/testpackage/id/"+id;
				}
				function testdelete(id){
					if (confirm("你确定要删除吗")==true)
						postwith('__URL__/testdelete',{id:id});
				}
				function starttest(id){
					if (confirm("你确定要开始测试吗")==true)
						postwith('__URL__/starttest',{id:id});
				}
					window.onload=show;
			</script>
	</head>
	<body>
	<!-- layout::Auth:header::0 -->
    	<div class="container-fluid">
     		<div class="row-fluid">
  			  <!-- layout::Auth:leftmenu::0 -->
              	 <div class="span8">
                    <div class="hero-unit">
                        <h1>试题管理</h1>
                        	  <p style="font-size:12px">当前位置：
                              <a href='__APP__/index/index'>主页</a>>
                              <a href='__URL__/index' >后台管理</a>>
                              <a href='__URL__/choose1' >测试管理</a>>
                              <a href="__URL__/testdetail">试题管理</a>
                            
            				</p>
                          </div>
				<a href="__URL__/testadd" class="btn btn-success">新建试卷</a>
                <hr>
		<table width="100%">
				<thead>
					<tr align="left">
						<th>试卷号</th>
						<th>试卷名</th>
						<th>试卷类型</th>
						<th>所属课程</th>
						<th>编辑者</th>
						<th>操作</th>
					</tr>
				</thead>
				<load href"__PUBLIC__/js/list_show.js">
				<tbody>
					<?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): ++$i;$mod = ($i % 2 )?><tr>
							<td><?php echo ($vo["id"]); ?></td> <!--试卷号-->
							<td><?php echo ($vo["name"]); ?></td> <!--试卷名-->
							<td><?php echo ($vo["type"]); ?></td> <!--试卷类型-->
							<td><?php echo ($vo["cname"]); ?></td><!--所属课程-->
							<td><?php echo ($vo["nname"]); ?></td><!--编辑者-->
							<td>
							<?php if($role == '学生' or $role == '访客'): ?>权限不够无法操作
								<?php else: ?>
									<a name="testedit" onClick="testedit('<?php echo ($vo["id"]); ?>')" href="#" class="btn btn-primary">预览</a>							
									<a name="testpackage" onClick="testpackage('<?php echo ($vo["id"]); ?>')" href="#" class="btn btn-info">组卷</a>
									<a name="delete_test" onClick="testdelete('<?php echo ($vo["id"]); ?>')" href="#" class="btn btn-danger">删除</a>
									<?php if($vo["type"] == "测试"): ?><a name="start_test" onClick="starttest('<?php echo ($vo["id"]); ?>')" href="#" class="btn btn-warring">开始测试</a><?php endif; ?><?php endif; ?>
							</td>
						</tr><?php endforeach; endif; else: echo "" ;endif; ?>
				</tbody>
	  </table>
		<p class="navbar-text pull-right"><?php echo ($page); ?></p>
	</div>
   </div>
  </div>
  <script src="__JS__/placeholderIEshow.js"></script>
	</body>
</html>